{% extends "personal_center/base.html" %}
{% load state_display %}
{% block page_link %}

{% endblock %}


{% block style %}
    <style>
        .add_class{
            background: #1E90FF;
        }
        .add_background {
            background: #A9A9A9;
        }
        tr td {
            height: 35px;padding-right: 1%;
        }
        th {
            text-align: center;
        }
        .top_tag {
            border-bottom: #01AAED solid 2px;color: #01AAED;
        }
        .tab_top {
            width: 100px;height: 40px;line-height: 40px;text-align: center;display: inline-block;cursor: pointer;
        }
        #meet_list td{
            width: 350px;height: 40px;border: #cfcfcf solid 1px;
        }
        #meet_list th{
            width: 350px;height: 40px;border: #cfcfcf solid 1px;
        }
        .shade1 {
            position: fixed;top: 0;left: 0;right: 0;bottom: 0;background-color: rgba(36, 36, 36, 0.5);display: none;z-index: 10000;
        }
        .a_tag_cla {
            display: block;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;height: 30px;line-height: 30px;padding-left: 1%;
        }
        .sing_title {
            width: 100px;height: 40px;display: inline-block;vertical-align: top;text-align: center;cursor: pointer;
        }
        .sing_title_active {
            color: #00a0e9;border-bottom: #00a0e9 solid 1px;
        }
        .button_for_control {
            width: 90px;height: 30px;border: 1px solid #99D3F5;background: #D0EEFF;border-radius: 4px;letter-spacing: 0;line-height: 30px;color: #089bab;margin: 5px 0;
        }
    </style>
{% endblock %}


{% block right_content %}
    <div style="width: 100%;height: 40px;background: white;border-bottom: #A9A9A9 solid 0.5px;line-height: 40px;padding-left: 1%;color: black;">
        <div style="width: 50%;height: 40px;float: left;">
            <div id="DW_tag" class="tab_top top_tag" onclick="change_mind('DW')">
                申请详情
            </div>
            <div id="LH_tag" class="tab_top" onclick="change_mind('LH')">
                附件
            </div>
        </div>

        <div id="" style="width: 100px;float: right;text-align: center;margin-right: 1%;height: 40px;">
            <button id="" onmousemove="page_zhanshi()" onmouseout="page_yincang()"
                    style="width: 100px;height: 30px;line-height: 27px;border: #1E90FF solid 1px;background: #1E90FF;color: white;margin-top: 5px;border-radius: 3px;">
                操作
            </button>
        </div>

        <div id="page_one" onmousemove="page_zhanshi()" onmouseout="page_yincang()"
             style="z-index: 1000; position: absolute; width: 100px; height: auto;right: 0.9%; top: 80px;background: #FFFFFF; box-shadow: rgb(204 204 204) 2px 2px 10px;padding: 5px;display: none;">
            <button onclick="print_topics()" class="button_for_control">
                打印
            </button>

            {% if is_audit == 'true' %}
                <button onclick="do_audit()" class="button_for_control">
                    审批
                </button>
            {% endif %}

            {% if SignDetailFlag == 'true' %}
                <button onclick="sing_detail_inline()" class="button_for_control">
                    签到详情
                </button>
            {% endif %}

            {% if sign_in_flag == 'true' %}
                <button onclick="open_check_in_code()" class="button_for_control">
                    签到码
                </button>
            {% endif %}
        </div>
    </div>

    <div id="appave-model" class="shade1">
        <div id="examine-model" style="width: 700px;background: white;left: 50%;top: 50%;position: absolute;transform: translate(-50%, -50%);">
            <div id="appave-title" style="width: 100%;height: 40px;border-bottom: #cfcfcf solid 1px;font-size: 14px;cursor: move;">
                <div style="width: 40%;height: 40px;line-height: 40px;text-align: left;padding-left: 1%;letter-spacing: 2px;float: left;">
                    审批
                </div>
                <div style="width: 59%;height: 40px;letter-spacing: 2px;float: left;">
                    <div onclick="close_models()" style="width: 40px;height: 40px;text-align: center;line-height: 40px;cursor: pointer;float: right;">
                        <i class="iconfont icon-quchu"></i>
                    </div>
                </div>
            </div>

            <div style="width: 100%;font-size: 14px;background: #E8E8E8;padding-top: 1%;">
                <div style="width: 98%;height: 150px;margin-left: 1%;background: white;padding-top: 1%;padding-left: 1%;border-radius: 3px;padding-right: 1%;">
                    <div style="width: 100%;height: 35px;line-height: 35px;border-bottom: #E8E8E8 solid 1px;padding-left: 1%;">
                        基本信息
                    </div>
                    <div style="width: 100%;height: 125px;padding-left: 1%;">
                        <div style="width: 100%;height: 50px;">
                            <div style="width: 49%;height: 50px;float: left;padding-left: 1%;color: #B5B5B5;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;line-height: 50px;">
                                <span style="color: #9C9C9C;">事      由：</span>{{ obj.particulars }}
                            </div>
                            <div style="width: 49%;height: 50px;float: right;padding-left: 1%;color: #B5B5B5;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;line-height: 50px;">
                                <span style="color: #9C9C9C;">会 议 室：</span>{{ obj.meeting_root }}
                            </div>
                        </div>

                        <div style="width: 100%;height: 50px;">
                            <div style="width: 49%;height: 50px;float: left;padding-left: 1%;color: #B5B5B5;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;line-height: 50px;">
                                <span style="color: #9C9C9C;">申请部门：</span>{{ obj.department }}
                            </div>
                            <div style="width: 49%;height: 50px;float: right;padding-left: 1%;color: #B5B5B5;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;line-height: 50px;">
                                <span style="color: #9C9C9C;">会议时间：</span>{{ obj.statr_time | date:"Y-m-d H:i" }} 至 {{ obj.end_time | date:"H:i" }}
                            </div>
                        </div>
                    </div>
                </div>

                <div style="width: 98%;margin-left: 1%;background: white;padding-top: 1%;padding-left: 1%;border-radius: 3px;margin-top: 1%;padding-right: 1%;padding-bottom: 20px;">
                    <div style="width: 100%;height: 35px;line-height: 35px;border-bottom: #E8E8E8 solid 1px;padding-left: 1%;">
                        意见
                    </div>
                    <div style="width: 100%;">
                        <textarea id="opinion_detail" placeholder="请输入审批意见" style="width: 96%;height: 100px;margin-left: 2%;margin-top: 1%;border: #cfcfcf solid 1px;outline: none;font-size: 14px;" ></textarea>
                    </div>
                </div>

                <div style="width: 100%;height: 40px;background: white;margin-top: 1%;text-align: right;padding-right: 2%;">
                    <button onclick="summit_data('audit')" style="letter-spacing: 3px;width: 100px;height: 30px;margin-top: 5px;border-radius: 1px;border: #00a0e9 solid 1px;text-align: center;background: #00a0e9;color: white;">同意</button>
                    <button onclick="summit_data('draft')" style="letter-spacing: 3px;width: 100px;height: 30px;margin-top: 5px;border-radius: 1px;border: #00a0e9 solid 1px;text-align: center;background: #00a0e9;color: white;margin-left: 15px;">退回修改</button>
                </div>
            </div>
        </div>
    </div>

    <div id="sign-in-model" class="shade1">
        <div id="sign-in-model" style="width: 70%;height: 700px;left: 50%;top: 50%;position: absolute;transform: translate(-50%, -50%);">
            <div style="width: 100%;height: 40px;font-size: 14px;">
                <div style="width: 100%;height: 40px;letter-spacing: 2px;">
                    <div onclick="close_sign_in()" style="width: 50px;height: 50px;text-align: center;line-height: 40px;cursor: pointer;float: right;">
                        <img src="../../static/personal_center/img/删除.png" alt="" style="width: 50px;height: 50px;">
                    </div>
                </div>
            </div>
            <div style="height: 95%;width: 100%;position: relative;">
                <div style="width: 700px;height: 700px;padding: 50px;position:absolute; top:0; right:0; bottom:0; left:0; margin:auto;background: white;">
                    <div id="output" style="width: 600px;height: 600px;"></div>
                </div>
            </div>
        </div>
    </div>

    <div id="sign-detail" class="shade1">
        <div id="sign-detail-model" style="width: 500px;background: white;left: 50%;top: 50%;position: absolute;transform: translate(-50%, -50%);">
            <div id="sign-detail-title" style="width: 100%;height: 40px;border-bottom: #cfcfcf solid 1px;font-size: 14px;">
                <div style="width: 75%;height: 40px;line-height: 40px;text-align: left;padding-left: 1%;letter-spacing: 2px;float: left;">
                    <div id="sing_alread" onclick="sing_click(this.id)" class="sing_title sing_title_active">已扫码</div>
                    <div id="sing_no" onclick="sing_click(this.id)" class="sing_title">未扫码</div>
                    <div id="sing_leave" onclick="sing_click(this.id)" class="sing_title">已请假</div>
                </div>
                <div style="width: 20%;height: 40px;letter-spacing: 2px;float: left;">
                    <div onclick="sing_detail_close()" style="width: 40px;height: 40px;text-align: center;line-height: 40px;cursor: pointer;float: right;">
                        <i class="iconfont icon-quchu"></i>
                    </div>
                </div>
            </div>

            <div style="width: 100%;height: 700px;background: white;font-size: 0;margin: 0;">
                <div id="sing_detail_alread" style="width: 100%;height: 100%;font-size: 14px;">
                    <div style="width: 100%;height: 30px;border-bottom: #cfcfcf solid 1px;background: #F5F5F5;">
                        <div style="width: 49%;height: 30px;display: inline-block;vertical-align: top;text-align: center;line-height: 30px;border-right: #cfcfcf solid 1px;">签到人</div>
                        <div style="width: 50%;height: 30px;display: inline-block;vertical-align: top;text-align: center;line-height: 30px;">签到时间</div>
                    </div>
                    <div id="sing_list" style="width: 100%;height: 95%;overflow: auto;">

                    </div>
                </div>

                <div id="sing_detail_not" style="width: 100%;height: 100%;display: none;font-size: 14px;">
                    {% if LeaveOperator == 'true' %}
                        <div style="width: 100%;height: 30px;border-bottom: #cfcfcf solid 1px;background: #F5F5F5;">
                            <div style="width: 49%;height: 30px;display: inline-block;vertical-align: top;text-align: center;line-height: 30px;border-right: #cfcfcf solid 1px;">人员</div>
                            <div style="width: 50%;height: 30px;display: inline-block;vertical-align: top;text-align: center;line-height: 30px;">操作</div>
                        </div>
                        <div id="no_sing_list" style="width: 100%;height: 95%;overflow: auto;">

                        </div>
                    {% else %}
                        <div style="width: 100%;height: 30px;border-bottom: #cfcfcf solid 1px;background: #F5F5F5;">
                            <div style="width: 100%;height: 30px;display: inline-block;vertical-align: top;text-align: center;line-height: 30px;border-right: #cfcfcf solid 1px;">人员</div>
                        </div>
                        <div id="no_sing_list" style="width: 100%;height: 95%;overflow: auto;">

                        </div>
                    {% endif %}
                </div>

                <div id="sing_detail_leave" style="width: 100%;height: 100%;display: none;font-size: 14px;">
                    <div style="width: 100%;height: 30px;border-bottom: #cfcfcf solid 1px;background: #F5F5F5;">
                        <div style="width: 100%;height: 30px;display: inline-block;vertical-align: top;line-height: 30px;border-right: #cfcfcf solid 1px;text-align: center;">请假人</div>
                    </div>
                    <div id="sing_leave_list" style="width: 100%;height: 95%;overflow: auto;">

                    </div>
                </div>
            </div>
        </div>
    </div>

    <div id="DW" style="width: 100%;height: 95%;background-color: white;overflow: auto;">
        <div id="menu_from" style="width: 100%;height: 100%;">
            <div style="width: 95%;margin-left: 2.5%;">
                <table id="car_table" style="width: 100%;margin-top: 2%;">
                    <tr style="width: 100%;">
                        <td colspan="4" style="width: 100%;border: #cfcfcf solid 0.5px;text-align: center;height: 35px;line-height: 35px;letter-spacing: 3px;">
                            <strong style="font-size: 20px;">会议室申请表</strong>
                        </td>
                    </tr>
                    <tr style="width: 100%;">
                        <td colspan="4" style="width: 100%;height: 40px;padding-left: 0.5%;line-height: 40px;margin-top: 1%;background: #dfdfdf;border: #cfcfcf solid 0.5px;border-bottom: none;">
                            申请详情
                        </td>
                    </tr>
                    <tr style="width: 100%;">
                        <td style="width: 15%;border: #cfcfcf solid 0.5px;text-align: right;height: 35px;line-height: 35px;letter-spacing: 1.7px;">
                            申&nbsp;请&nbsp;人
                        </td>
                        <td id="applicat"
                            style="width: 35%;height: 35px;line-height: 35px;padding-left: 1%;border: #cfcfcf solid 0.5px;">{{ obj.names }}</td>

                        <td style="width: 15%;border: #cfcfcf solid 0.5px;text-align: right;height: 35px;line-height: 35px;">
                            申请部门
                        </td>
                        <td id="department"
                            style="width: 35%;border: #cfcfcf solid 0.5px;padding-left: 1%;line-height: 35px;">{{ obj.department }}</td>
                    </tr>
                    <tr style="width: 100%;">
                        <td style="width: 15%;border: #cfcfcf solid 0.5px;text-align: right;height: 35px;line-height: 35px;">
                            开始时间
                        </td>
                        <td id="start_time"
                            style="width: 35%;height: 35px;line-height: 35px;padding-left: 1%;border: #cfcfcf solid 0.5px;">{{ obj.statr_time | date:"Y-m-d H:i" }}</td>

                        <td style="width: 15%;border: #cfcfcf solid 0.5px;text-align: right;height: 35px;line-height: 35px;">
                            结束时间
                        </td>
                        <td id="end_time"
                            style="width: 35%;border: #cfcfcf solid 0.5px;padding-left: 1%;line-height: 35px;">{{ obj.end_time | date:"Y-m-d H:i" }}</td>
                    </tr>
                    <tr style="width: 100%;">
                        <td style="width: 15%;border-right: #cfcfcf solid 0.5px;border-left: #cfcfcf solid 0.5px;border-bottom: #cfcfcf solid 0.5px;height: 35px;line-height: 35px;text-align: right;letter-spacing: 1.7px;">
                            会&nbsp;议&nbsp;室
                        </td>
                        <td id="itinerary" colspan="3" style="width: 85%;border-right: #cfcfcf solid 0.5px;border-left: #cfcfcf solid 0.5px;border-bottom: #cfcfcf solid 0.5px;height: 35px;line-height: 35px;padding-left: 1%;">{{ obj.meeting_root }}</td>
                    </tr>
                    <tr style="width: 100%;">
                        <td style="width: 15%;border-right: #cfcfcf solid 0.5px;border-left: #cfcfcf solid 0.5px;border-bottom: #cfcfcf solid 0.5px;height: 35px;line-height: 35px;text-align: right;">
                            事&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;由
                        </td>
                        <td id="itinerary" colspan="3" style="width: 85%;border-right: #cfcfcf solid 0.5px;border-left: #cfcfcf solid 0.5px;border-bottom: #cfcfcf solid 0.5px;height: 35px;line-height: 35px;padding-left: 1%;">{{ obj.particulars }}</td>
                    </tr>
                    <tr style="width: 100%;">
                        <td style="width: 15%;border-right: #cfcfcf solid 0.5px;border-left: #cfcfcf solid 0.5px;border-bottom: #cfcfcf solid 0.5px;height: 35px;line-height: 35px;text-align: right;">
                            参会人数
                        </td>
                        <td id="field_leader" colspan="3" style="width: 85%;border-right: #cfcfcf solid 0.5px;border-left: #cfcfcf solid 0.5px;border-bottom: #cfcfcf solid 0.5px;height: 35px;line-height: 35px;padding-left: 1%;">
                            {{ obj.Number_people }}</td>
                    </tr>
                    <tr style="width: 100%;">
                        <td style="width: 15%;border-right: #cfcfcf solid 0.5px;border-left: #cfcfcf solid 0.5px;border-bottom: #cfcfcf solid 0.5px;height: 35px;line-height: 35px;text-align: right;">
                            参会人员
                        </td>
                        <td id="car_marks" colspan="3" style="width: 85%;border-right: #cfcfcf solid 0.5px;border-left: #cfcfcf solid 0.5px;border-bottom: #cfcfcf solid 0.5px;height: 35px;line-height: 35px;padding-left: 1%;">{{ obj.conferee|Participants }}</td>
                    </tr>
                    <tr style="width: 100%;">
                        <td colspan="4" style="width: 100%;height: 40px;padding-left: 0.5%;line-height: 40px;margin-top: 1%;background: #dfdfdf;border: #cfcfcf solid 0.5px;border-bottom: none;">
                            审批详情
                        </td>
                    </tr>
                    <tr style="width: 100%;">
                        <td style="width: 15%;border: #cfcfcf solid 0.5px;height: 100px;line-height: 100px;text-align: right;">
                            医院办公室
                        </td>
                        <td colspan="3" style="width: 85%;border: #cfcfcf solid 0.5px;padding-left: 1%;">
                            {% if obj.state != 'unaudit' %}
                                <div style="width: 100%;line-height: 20px;position: relative;">
                                    <span>
                                        {% if obj.state == 'draft' %}
                                             拒绝
                                        {% else %}
                                            已审核
                                        {% endif %}</span>
                                    <span style="margin-left: 3%">{{ obj.audit_note }}</span>
                                </div>
                                <div>
                                    <img src="/media/{{ signature_picture }}" alt="" style="width: 150px; height: 60px;">
                                </div>
                                <div style="text-align: right;color: #0b0b0b;">{{ item.audit_time }}</div>
                            {% endif %}
                        </td>
                    </tr>
                    {% if register_flag == 'true' and sing_people|length %}
                        <tr style="width: 100%;">
                            <td colspan="4" style="width: 100%;height: 40px;padding-left: 0.5%;line-height: 40px;margin-top: 1%;background: #dfdfdf;border: #cfcfcf solid 0.5px;">
                                签到人员
                            </td>
                        </tr>
                        <tr style="width: 100%;">
                            <td colspan="4" style="width: 100%;border: #cccccc solid 1px;border-top: none;outline: none;padding-left: 1%;">
                                <div style="width: 100%;position: relative;">
                                    {% for receiv in sing_people %}
                                        <div style="width: 100%; height: 80px; border-bottom: 1px solid rgb(204, 204, 204);">
                                            <div>
                                                <img style="width: 100px;height: 40px;" src="{{ receiv.signature_picture }}">
                                            </div>
                                            <div style="position: absolute; right: 0px; width: 300px; text-align: right; color: rgb(11, 11, 11); line-height: 0px;">{{ receiv.time }}</div>
                                        </div>
                                    {% endfor %}
                                </div>
                            </td>
                        </tr>
                    {% endif %}
                </table>
            </div>

            <div style="width: 100%;text-align: center;">
                <div style="margin-top: 50px;">
                    <h3>当前会议室使用列表</h3>
                </div>
                <div style="font-size: 10px;text-align: center;margin-top: 1%;">
                    <div style="width: 15px;height: 15px;background: #0abb78;display: inline-block;vertical-align: center;margin-left: 10px;"></div>
                    <div style="display: inline-block;vertical-align: top;margin-top: -3px;">当前审批流程</div>
                </div>
                <table id="meet_list" style="margin: 2.5%;margin-top: 1%;">
                     <tr>
                         <th>会议室名称</th>
                         <th>申请人</th>
                         <th>申请时间</th>
                         <th>会议事由</th>
                         <th>开始时间</th>
                         <th>结束时间</th>
                         <th>会议状态</th>
                         <th>是否冲突</th>
                         <th>审批状态</th>
                    </tr>
                    {% for history_list_obj in history_list_objs %}
                        <tr style="color: {% if history_list_obj.SameTop == '1' %} #0abb78 {% else %} #0b0b0b {% endif %}">
                            <td style="text-align: center;">{{ history_list_obj.meeting_root }}</td>
                            <td style="text-align: center;">{{ history_list_obj.names }}</td>
                            <td style="text-align: center;">{{ history_list_obj.create_time|date:"Y-m-d H:i" }}</td>
                            <td style="text-align: left;padding-left: 0.5%;"><a style="color: {% if history_list_obj.SameTop == '1' %} #0abb78 {% else %} #0b0b0b {% endif %}" href="/personal-center/conference_room_detail?id={{history_list_obj.id}}">{{ history_list_obj.particulars }}</a></td>
                            <td style="text-align: center;">{{ history_list_obj.statr_time|date:"Y-m-d H:i" }}</td>
                            <td style="text-align: center;">{{ history_list_obj.end_time|date:"Y-m-d H:i" }}</td>
                            <td style="text-align: center;">
                                {% if history_list_obj.status == '0' %}未开始
                                {% elif history_list_obj.status == '1' %}进行中
                                {% elif history_list_obj.status == '2' %}已结束
                                {% endif %}
                            </td>
                            <td style="text-align: center;">
                                {% if history_list_obj.conflict == '2' %}
                                    <p style="color: red;">冲突</p>
                                {% else %}
                                    <p>正常</p>
                                {% endif %}
                            </td>
                            <td style="text-align: center;">
                                {% if history_list_obj.state == 'audit' %}<a style="color: {% if history_list_obj.SameTop == '1' %} #0abb78 {% else %} #0b0b0b {% endif %}" href="/personal-center/conference_room_detail?id={{history_list_obj.id}}">已审核</a>
                                {% elif history_list_obj.state == 'draft' %}<a style="color: {% if history_list_obj.SameTop == '1' %} #0abb78 {% else %} #0b0b0b {% endif %}" href="/personal-center/conference_room_detail?id={{history_list_obj.id}}">拒绝</a>
                                {% else %}<a style="color: {% if history_list_obj.SameTop == '1' %} #0abb78 {% else %} #0b0b0b {% endif %}" href="/personal-center/conference_room_detail?id={{history_list_obj.id}}">未审批</a>
                                {% endif %}
                            </td>
                        </tr>
                    {% endfor %}
                </table>
            </div>
        </div>
    </div>

    <div id="LH" style="width: 100%;height: 94%;background: white;display: none;">
        <div style="display: inline-block;width: 20%;vertical-align: top;height: 99%">
            <div style="width: 100%;height: 40px;background: #c8cbcf;padding-left: 2%;line-height: 40px;color: #0c6fd9;">
                附件
            </div>
            <div id="yt_zhengwen" style="width: 100%;">
                {% for item in file_list %}
                    <div><a href="#" class="a_tag_cla" onclick="chage_yulan(this, '{{ item.file_path }}')">{{ item.file_name }}</a></div>
                {% endfor %}
            </div>
        </div>
        <div style="display: inline-block;width: 78%;vertical-align: top;height: 99%;text-align: center;" id="fujian">
            {% if 'jpg' in file_path or 'JPG' in file_path or 'JPEG' in file_path or 'jpeg' in file_path or 'PNG' in file_path or 'png' in file_path %}
                <img src="{{ file_path }}" alt="" style="width: 800px;height: 100%;">
            {% else %}
                <embed id="embed_file" src="{{ file_path }}" type="application/pdf" style="width: 100%;height: 100%;">
            {% endif %}
        </div>
    </div>

{% endblock %}


{% block script %}
    <script language="javascript" src="../../static/personal_center/js/jquery-1.4.4.min.js"></script>
    <script language="javascript" src="../../static/personal_center/js/jquery.jqprint-0.3.js"></script>
    <script type="text/javascript" src="../../static/personal_center/js/jquery.qrcode.min.js"></script>
    <script>
        window.onload = function () {
            document.getElementById("sponsor").className = "add_class";
            document.getElementById("personage").className = "add-nav-active";
            {#clearInterval(interval)#}
        };

        let appave_title = document.querySelector("#appave-title");
        let examine_model = document.querySelector("#examine-model");

        appave_title.addEventListener("mousedown", function (e) {
            let x = e.pageX - examine_model.offsetLeft;
            let y = e.pageY - examine_model.offsetTop;
            document.addEventListener("mousemove", move);

            function move(e) {
                examine_model.style.left = e.pageX - x + 'px';
                examine_model.style.top = e.pageY - y + 'px';
            }

            document.addEventListener("mouseup", function (e) {
                document.removeEventListener("mousemove", move);
            })
        });

        function change_mind(ele_id) {
            if (ele_id === "DW") {
                document.getElementById("DW").style.display = "inline-block";
                document.getElementById("DW_tag").className = "tab_top top_tag";
                document.getElementById("LH_tag").className = "tab_top";
                document.getElementById("LH").style.display = "none";
            } else {
                document.getElementById("LH").style.display = "inline-block";
                document.getElementById("LH_tag").className = "tab_top top_tag";
                document.getElementById("DW_tag").className = "tab_top";
                document.getElementById("DW").style.display = "none";
            }
        }

        function do_audit(){
            document.getElementById("appave-model").style.display="table-row";
        }

        function close_models() {
            document.getElementById("appave-model").style.display="none";
        }

        function summit_data(approve) {
            var audit_note = document.getElementById("opinion_detail").value;

            if (approve === "draft"){
                if (!audit_note){
                    alert("不同意请填写理由！");
                    return false
                }
            }
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/personal-center/conference_room_audit");
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
            xhr.send("id={{ obj.id }}&state="+String(approve)+"&audit_note="+String(audit_note));
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        if (JsonDate["code"] === 200){
                            alert("审批成功");
                            window.location.href="/personal-center/process_management.html?type=我的待办&folw_type=&folw=&page=1&page_size=20&wd="
                        }else {
                            alert(JsonDate["message"]);
                        }
                    }
                }
            };
        }

        function chage_yulan(this_, file_path) {
            var fujian = document.getElementById("fujian");
            var file_index = file_path.lastIndexOf(".")
            var ext = file_path.substring(file_index + 1)
            var arr = ['jpg', 'JPG', "JPEG", "jpeg", "PNG", "png"];
            var ext_index = arr.indexOf(ext);
            if (ext_index === -1) {
                fujian.innerHTML = '<embed id="embed_file" src="' + file_path + '" type="" style="width: 100%;height: 100%;">'
            } else {
                fujian.innerHTML = '<img src="' + file_path + '" alt="application/pdf" style="width: 800px;height: 100%;">'
            }

            var a_tag_list = document.getElementsByClassName("a_tag_cla");
            for (var i = 0; i < a_tag_list.length; i++) {
                a_tag_list[i].style.background = '';
            }
            this_.style.background = '#cfcfcf';
        }

        function open_check_in_code() {
            document.getElementById("sign-in-model").style.display="table-row";
            document.getElementById("output").innerHTML = "";
            var timestamp = new Date().getTime();
            var local_host = window.location.host;
            jQuery('#output').qrcode("https://oaapi.hbjsxrmyy.com/new-flow-logic/meeting_room_scan_code_confirmation?flow_id={{ flow_id | safe }}&type=1&timestamp=" + String(timestamp) + "&type=1");
            interval = setInterval(create_sing_code,13000);
        }

        function create_sing_code() {
            document.getElementById("output").innerHTML = "";
            var timestamp = new Date().getTime();
            var local_host = window.location.host;
            jQuery('#output').qrcode("https://oaapi.hbjsxrmyy.com/new-flow-logic/meeting_room_scan_code_confirmation?flow_id={{ flow_id | safe }}&timestamp=" + String(timestamp) + "&type=1");
        }

        function close_sign_in() {
            document.getElementById("sign-in-model").style.display="none";
            clearInterval(interval)
        }

        function sing_detail_inline() {
            document.getElementById("sign-detail").style.display="table-row";
            var xhr = new XMLHttpRequest();
            var LeaveOperator = '{{ LeaveOperator | safe }}';
            xhr.open('post', "/new-flow-logic/MeetingRoomCheckDetail");
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
            xhr.send("id={{ obj.id }}");
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        document.getElementById("sing_list").innerHTML = '';
                        document.getElementById("no_sing_list").innerHTML = '';
                        document.getElementById("sing_leave_list").innerHTML = '';
                        for (var i=0; i<JsonDate["alread_list"].length; i++) {
                            var alread_str = `
                                <div style="width: 100%;height: 30px;border-bottom: #cfcfcf solid 1px;">
                                    <div style="width: 49%;height: 30px;display: inline-block;vertical-align: top;text-align: center;line-height: 30px;border-right: #cfcfcf solid 1px;">`+JsonDate["alread_list"][i]['name']+`</div>
                                    <div style="width: 50%;height: 30px;display: inline-block;vertical-align: top;text-align: center;line-height: 30px;">`+JsonDate["alread_list"][i]['time']+`</div>
                                </div>
                            `
                            $("#sing_list").append(alread_str);
                        }
                        for (var j=0; j<JsonDate["no_list"].length; j++) {
                            if (LeaveOperator === 'true') {
                                var no_str = `
                                    <div style="width: 100%;height: 30px;border-bottom: #cfcfcf solid 1px;">
                                        <div style="width: 49%;height: 30px;display: inline-block;vertical-align: top;text-align: center;line-height: 30px;border-right: #cfcfcf solid 1px;">`+JsonDate["no_list"][j]['name']+`</div>
                                        <div style="width: 50%;height: 30px;display: inline-block;vertical-align: top;text-align: center;line-height: 30px;cursor: pointer;color: #2db7f5;" onclick="PersonnelLeave('`+JsonDate["no_list"][j]['name']+`', '`+JsonDate["no_list"][j]['id']+`', '`+JsonDate["no_list"][j]['flow_id']+`')">请假</div>
                                    </div>
                                `
                            }else {
                                no_str = `
                                    <div style="width: 100%;height: 30px;border-bottom: #cfcfcf solid 1px;">
                                        <div style="width: 100%;height: 30px;display: inline-block;vertical-align: top;text-align: center;line-height: 30px;border-right: #cfcfcf solid 1px;">`+JsonDate["no_list"][j]['name']+`</div>
                                    </div>
                                `
                            }
                            $("#no_sing_list").append(no_str);
                        }
                        for (var k=0; k<JsonDate["leave_list"].length; k++) {
                            var leave_str = `
                                <div style="width: 100%;height: 30px;border-bottom: #cfcfcf solid 1px;">
                                    <div style="width: 100%;height: 30px;display: inline-block;vertical-align: top;text-align: center;line-height: 30px;border-right: #cfcfcf solid 1px;">`+JsonDate["leave_list"][k]['name']+`</div>
                                </div>
                            `
                            $("#sing_leave_list").append(leave_str);
                        }
                    }
                }
            };
        }

        function sing_detail_close() {
            document.getElementById("sign-detail").style.display="none";
        }

        function sing_click(ele_id) {
            if (ele_id === "sing_alread") {
                document.getElementById("sing_alread").className = "sing_title sing_title_active";
                document.getElementById("sing_no").className = "sing_title";
                document.getElementById("sing_leave").className = "sing_title";
                document.getElementById("sing_detail_alread").style.display = "block";
                document.getElementById("sing_detail_not").style.display = "none";
                document.getElementById("sing_detail_leave").style.display = "none";
            }else if (ele_id === "sing_leave") {
                document.getElementById("sing_alread").className = "sing_title";
                document.getElementById("sing_no").className = "sing_title";
                document.getElementById("sing_leave").className = "sing_title sing_title_active";
                document.getElementById("sing_detail_leave").style.display = "block";
                document.getElementById("sing_detail_alread").style.display = "none";
                document.getElementById("sing_detail_not").style.display = "none";
            }else {
                document.getElementById("sing_no").className = "sing_title sing_title_active";
                document.getElementById("sing_alread").className = "sing_title";
                document.getElementById("sing_leave").className = "sing_title";
                document.getElementById("sing_detail_not").style.display = "block";
                document.getElementById("sing_detail_alread").style.display = "none";
                document.getElementById("sing_detail_leave").style.display = "none";
            }
        }
        
        function PersonnelLeave(leave_person, person_id, flow_id) {
            var PromptInformation = confirm("是否确认 "+leave_person+" 请假？")
            if (PromptInformation) {
                var xhr = new XMLHttpRequest();
                xhr.open('post', "/new-flow-logic/ask_for_leave");
                xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
                xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
                xhr.send("person_id="+String(person_id)+"&flow_id="+String(flow_id));
                xhr.onreadystatechange = function () {
                    if (xhr.readyState === 4) {
                        if (xhr.status === 200) {
                            document.getElementById("loading").style.display = "none";
                            var JsonDate = JSON.parse(xhr.responseText);
                            if (JsonDate["code"] === 200){
                                alert("操作成功");
                                window.location.reload();
                            }else {
                                alert(JsonDate["message"]);
                            }
                        }
                    }
                };
            }
        }

        function page_zhanshi() {
            document.getElementById('page_one').style.display = 'inline-block';
        }

        function page_yincang() {
            document.getElementById('page_one').style.display = 'none';
        }

        function print_topics() {
            $('#menu_from').jqprint({
                debug: false,
                importCSS: true,
                printContainer: true,
                operaSupport: false
            });
        }
    </script>
{% endblock %}
